﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using NUnit.Framework;
using Rhino.Mocks;
using NSynx.FlowEngine;
using NSynx.FlowEngine.Interfaces;
using System.Diagnostics;
using System.Collections;

namespace NSynx.Test
{
    [TestFixture]
    public class FlowTest
    {
        
        MockRepository repo;
        Flow flow; 

        [TestFixtureSetUp]
        public void Init()
        {
            repo = new MockRepository();
            CreateANewFlow();
        }

        [TestFixtureTearDown]
        public void End()
        {
            Debug.Write("Called");
        }


        [Test]
        public void Action()
        {
            IAction myAction = repo.StrictMock<IAction>();
            IExecutionStep step = repo.StrictMock<IExecutionStep>();
            IFlowContext flowContext = repo.StrictMock<IFlowContext>();
            
        }

        public void CreateANewFlow()
        {
            flow = new Flow();
        }

        [Test]
        public void AddAnActionTotheContainerCheckIfItContains()
        {
            AddANewAction();

            Assert.AreEqual(1, flow.Count);

            RemoveActionsFromFlowObject();
        }

        [Ignore]
        public void AddANewAction()
        {
            IAction actionStep = repo.StrictMock<IAction>();

            flow.Add(actionStep);
        }

        [Ignore]
        public void RemoveActionsFromFlowObject()
        {
            flow.RemoveAll();
        }

        [Test]
        public void AddAnActionTotheContainerAndRemoveAllCheckIfItContainsAnything()
        {
            AddANewAction();
            //Expect.Call(flow.Count).Return(1);
            RemoveActionsFromFlowObject();

            Assert.AreEqual(0, flow.Count);
        }

        private IAction GetAnAction()
        {
            IAction testAction = new TestAction();
            testAction.ActionName = "TestAction101";
            return testAction;
        }

        [Test]
        public void ExecuteActions()
        {
            flow.Add(GetAnAction());

            flow.Execute();
        }
    }

   
}
